package com.guomao.demob;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.function.Function;

public class JavaDemo4 {

    public static void main(String[] args) {

        String num = "200";
        method1((String s) -> {
            return Integer.parseInt(s);
        }, num);

        Date d = new Date();
        //System.out.println(d);//Thu Aug 21 13:59:45 CST 2025 -> 2025年8月21号 13点59分45秒

        method2(date -> {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            return sdf.format(d);
        }, d);

    }

    public static void method1(Function<String, Integer> function, String s) {
        Integer result = function.apply(s);
        System.out.println(result + 100);
    }


    public static void method2(Function<Date, String> function, Date date) {
        String time = function.apply(date);
        System.out.println(time);
    }
}
